//获取应用实例
var app = getApp()
Page({
  data: {
    user: {},
    iconUrl: "../../image/icon-arrowdown.png"
  },

  onLoad: function () {
    this.setData({
      user: app.globalData.user
    })
  },

  onShow: function () {
      if (this.data.user.userId != "") {
        var that = this
        wx.request({
          url: 'https://eis.natappvip.cc/ITSupport/user_getUserById.action',
          data: {
            'user.userId': this.data.user.userId,
          },
          header: {
            "content-type": "application/x-www-form-urlencoded"
          },
          method: "POST",
          success: function (res) {
            let jsonresult = JSON.parse(res.data)
            console.log(jsonresult.result)
            if (jsonresult.result == "error"){              
              that.setData({
                message: jsonresult.msg
              })
            } else {
              app.globalData.user = jsonresult.user
              that.setData({
                user: jsonresult.user
              })
            }
          },
          fail: function (err) {
            console.log(err)
          }
        })
      }
  },

  myReply:function(){
    wx.navigateTo({
      url: '../myReply/myReply',
    })
  },

  myTopic: function () {
    wx.navigateTo({
      url: '../myTopic/myTopic',
    })
  },

  loginout:function(){
    wx.redirectTo({
      url: '../login/login',
    })
  }


})

